﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Xml;

namespace MOVIE_THEATER
{
    public class ConnectDatabase
    {
        public SqlConnection conn = new SqlConnection();
        public void ConnectDB()
            {
               // conn.ConnectionString = "Data Source=PHAMDANHVU-PC;Initial Catalog=QLRAPPHIM;Integrated Security=True";
                conn.ConnectionString = ReadConnectionString("DataString.xml");
                //conn.ConnectionString = "server = THANHTUAN-PC; database = QLRAPPHIM; Uid = sa; Pwd = sa;";
                conn.Open();
            }
        public static String ReadConnectionString(string file)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(file);
                XmlElement root = doc.DocumentElement;
                String connectionString = root.InnerText;
                return connectionString;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
    }
}
